Skip to content

feat(cli): add 'concore add-node' to add a starter node to a project - #696

Open
yadavchiragg wants to merge 1 commit into
ControlCore-Project:devfrom
yadavchiragg:feat/cli-add-node
Open

yadavchiragg wants to merge 1 commit into
ControlCore-Project:devfrom
yadavchiragg:feat/cli-add-node

Conversation

@yadavchiragg

Copy link
Copy Markdown

Why

concore init --interactive creates stub nodes for Python, C++, Octave, Verilog and Java, but only while creating a new project. Adding another node later means copying a stub and editing workflow.graphml by hand.

What

concore add-node <project_dir> --lang python|cpp|octave|verilog|java

  • writes the same stub init uses into src/ and appends a matching, unconnected node to workflow.graphml (to be wired up in yEd)
  • picks free names: script.py, script2.py, ... and for Java renames the class so Script2.java still compiles
  • places the node below the existing ones; uses the file's own nodegraphics key id and keeps its line endings (CRLF files stay CRLF)
  • clear errors for a directory without workflow.graphml

Testing

  • tests/test_add_node_command.py (8 tests), including CRLF + non-default key id, name collisions, Java class rename, and that the project still validates
  • init -> add-node -> validate -> build --type posix run end to end
  • existing CLI tests unchanged, ruff clean

Docs

Added concore add-node to concore_cli/README.md

concore init --interactive can create nodes, but only when creating a new project. add-node adds a stub source file plus a matching workflow.graphml node to an existing project, picking free file names, renaming the Java class to match, keeping the file's graphics key and line endings. Tests and docs included.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant